import Vue from 'vue'
import App from './App.vue'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import router from './router'
import VueLazyLoad from 'vue-lazyload'
import VueCookie from 'vue-cookie'
import axios from 'axios'
// import coreJs from 'coreJs'
// import jsonp from 'jsonp'
import VueAxios from 'vue-axios'
// import Env from './env'//对于插件系统会自己去node_moudle模块里面找,但是自己的文件必须要加./ 

//根据前端的跨域方式来做调整
axios.defaults.baseURL='/api';
axios.defaults.timeout=8000;

// 根据环境变量获取不同的请求地址 
// axios.defaults.baseURL=env.baseURL;

//拦截器
axios.interceptors.response.use(function(response){
 let res = response.data;
 if(res.status == 0){
   return res.data;
 }else if(res.status == 10){
    window.location.href='/#/login';
 }else{
   alert(res.msg);
}
});


Vue.use(VueAxios,axios);
Vue.config.productionTip = false

Vue.use(ElementUI);


new Vue({
  VueCookie,
  VueLazyLoad,
  router,
  render: h => h(App),
}).$mount('#app')
